package io.github.mayubao.kotlintest

import org.junit.Assert
import org.junit.Assert.assertEquals
import org.junit.Test

/**
 * Override Operator, essentialy, it is an override method
 */
class Day20_OperatorOverrideTest{


    @Test
    fun tesOverrideOperator(){
        var o = OperatorDemo()
        o ++
        assertEquals(10, o.i)

        //val keyword means the variable is immutable
    }

    class OperatorDemo{
        var i = 0;

        operator fun inc() : OperatorDemo {
            i += 10
            return this
        }
    }
}